//
//  main.cpp
//  TestHttplibServer
//
//  Created by huge on 2021/8/5.
//  Copyright © 2021 huge. All rights reserved.
//

#include <iostream>
#include "httplib.h"
#include <thread>

int main(int argc, const char * argv[]) {
    // insert code here...
    std::cout << "server is ready!\n";

    // HTTP
    httplib::Server svr;
    svr.set_read_timeout(50000);
    svr.set_write_timeout(50000);
    
    svr.Get("/hi", [](const httplib::Request &, httplib::Response &res) {
        std::cout << "client request!" << "\n";

        sleep(3);
        std::cout << " I am awake!" << "\n";
        res.set_content("Hello httplib!", "text/plain");
    });
    
    svr.listen("0.0.0.0", 8088);
    

    return 0;
}
